// 下载vue-router npm i -S vue-router@3 只下载一次即可
import Vue from "vue";
import VueRouter from "vue-router";

// 在路由器模块当中注册路由
import ShouYe from '../views/ShouYe.vue';
import FenLei from '../views/FenLei.vue';
import Car from '../views/Car.vue';
import PersonCenter from '../views/PersonCenter.vue';
// 引入二级路由
import NavOne from '../views/shouYe/NavOne.vue';
import NavTwo from '../views/shouYe/NavTwo.vue';
import NavThree from '../views/shouYe/NavThree.vue';

// 命名视图
import Content from '../views/Content.vue';
import ContentTwo from '../views/ContentTwo.vue'

// import Register from '../views/Register.vue';
// import Login from '../views/Login.vue';

Vue.use(VueRouter);

let router = new VueRouter({
    mode:'history',
    routes:[
        {
            path:'/shouye',
            name:'shouye',
            alias:'/shaerzi',
            components:{
                default:ShouYe,
                Content,
                ContentTwo
            },
            // 在首页这个路由组件当中再来一层导航
            // 嵌套路由 二级路由 三级路由
            children:[
                {
                    path:'/shouye/navone',
                    name:'navone',
                    component:NavOne
                },
                {
                    // 对于嵌套路由 注意路径的写法 开头有/必须将路径写全 如果不写 / 就直接写当前子路由的路径
                    path:'navtwo',
                    name:'navtwo',
                    component:NavTwo
                },
                {
                    path:'/shouye/navthree',
                    name:'navthree',
                    component:NavThree
                }
            ]
        },
        {
            path:'/fenlei',
            name:'fenlei',
            components:{
                default:FenLei,
                Content,
                ContentTwo
            }
        },
        {
            path:'/car',
            name:'car',
            components:{
                default:Car,
                Content,
                ContentTwo
            }
        },
        {
            path:'/personcenter',
            name:'personcenter',
            components:{
                default:PersonCenter,
                Content,
                ContentTwo
            }
        },
        {
            // 路由重定向
            path:'/',
            redirect:'/shouye' 
        },
        // {
        //     path:'/register',
        //     name:'register',
        //     component:
        // }
    ]
})

export default router;